package personal.xjl._23java1studentdemo.spring;


import jdk.jfr.Category;
import lombok.AllArgsConstructor;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Component("myAnotherAdvice")
@Aspect
public class MyAnotherAdvice {
    @After("execution(* NiuCar.run())")
    public void afterReturning() throws Throwable {
        System.out.println("---------这是后置增强--------");
    }
    @Before("execution(* Niu.run())")
    public void before() throws Throwable {
        System.out.println("---------这是前置增强----------");
    }
    @Around("execution(* MyMath.mul())")
    public Object around(ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("---------环绕增强开始了----------");
        Object result = pjp.proceed();
        System.out.println("---------环绕增强结束了----------");
        return result;
    }
    }

